{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from GetHist import GetHist\n",
    "\n",
    "gh = GetHist('601699', start='2018-01-01', end='2018-01-20')\n",
    "data = gh.get_hist_numpy()\n",
    "data = gh.fall_one(data, 2, True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# print(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "def init_para(layer_dims):\n",
    "    para = {}\n",
    "    for dim in range(len(layer_dims)-1):\n",
    "        para['W' + str(dim+1)] = np.random.rand(layer_dims[dim+1], layer_dims[dim]) * 0.01\n",
    "        para['b' + str(dim+1)] = np.zeros([layer_dims[dim+1], 1])\n",
    "        para['A' + str(dim+1)] = None\n",
    "    return para"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# print(init_para([3,2,4,1]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def active_function(A, tag):\n",
    "    Z = None\n",
    "    if tag == 'sigmoid':\n",
    "        Z = 1 / (1 + np.exp(-A))\n",
    "    elif tag == 'relu':\n",
    "        Z = np.maximum(0, A)\n",
    "    elif tag == 'tanh':\n",
    "        Z = (1-np.exp(-A)) / (1+np.exp(-A))\n",
    "    else:\n",
    "        raise 'active function is None.'\n",
    "    return Z"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def linear(X, para):\n",
    "    lin_times = len(para) // 3\n",
    "    A_prev = X\n",
    "    for lt in range(lin_times-1):\n",
    "        A_prev = active_function(np.dot(para['W' + str(lt+1)], A_prev) + para['b' + str(lt+1)], 'relu')\n",
    "        para['A' + str(lt+1)] = A_prev\n",
    "    #股票涨跌， 一日最高为上下10点。\n",
    "#     print('A')\n",
    "#     print(active_function(np.dot(para['W' + str(lin_times)], A_prev) + para['b' + str(lin_times)], 'tanh'))\n",
    "    para['A' + str(lin_times)] = active_function(np.dot(para['W' + str(lin_times)], A_prev) + para['b' + str(lin_times)], 'tanh')\n",
    "    return para['A' + str(lin_times)], para"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "Z, para = linear(np.random.randn(3, 2), init_para([3,2,4,1]))\n",
    "# print(para)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def cost_function(Y, A):\n",
    "#     return -(Y * np.log(A) + (1-Y) * np.log(1-A))\n",
    "    return np.squeeze(np.sum(pow(Y-A, 2), axis=1) / len(A))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "def forward_broadcast():\n",
    "    X = data[0:-1]\n",
    "    Y = data[-1].reshape(1, -1)\n",
    "    \n",
    "    np.random.seed(0)\n",
    "    para = init_para([X.shape[0], 20, 1])\n",
    "    Z, para = linear(X, para)\n",
    "    \n",
    "    cf = cost_function(Y, Z)\n",
    "    \n",
    "    print(Z, cf)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "# forward_broadcast()\n",
    "# print(data[-1, keepdim=True].shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "def active_back(A,  dA, tag):\n",
    "    if tag == 'sigmoid':\n",
    "        return A * (1 - A) * dA\n",
    "    elif tag == 'relu':\n",
    "        A = dA\n",
    "        A[A<=0] = 0\n",
    "        return A\n",
    "    elif tag == 'tanh':\n",
    "        return (1-pow(A, 2)) * dA"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# active_back(np.random.randn(3,2), 'relu')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "def cost_back(Y, A):\n",
    "#     print(Y)\n",
    "#     print(A)\n",
    "    return -2 * (Y - A)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "def linear_back(A_prev, W, b, dZ):\n",
    "    dW = np.dot(dZ, A_prev.T)\n",
    "    db = np.sum(dZ, axis=1, keepdims=True) / b.shape[1] \n",
    "    dA = np.dot(W.T, dZ)\n",
    "    return dW, db, dA"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "# print(linear_back(np.random.randn(3, 2), np.random.randn(4,1), np.random.randn(4,2)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "from GetHist import GetHist\n",
    "def main_run(code, start, end, step, learning_times=10000, learning_rate = 0.01):\n",
    "    timess1 = ['2017-01-1', '2017-02-1', '2017-03-1', '2017-04-1', '2017-05-1', '2017-06-1', '2017-07-1']\n",
    "    timess2 = ['2017-01-31', '2017-02-31', '2017-03-31', '2017-04-31', '2017-05-31', '2017-06-31', '2017-07-31']\n",
    "    \n",
    "    cost_list = []\n",
    "    init_ = True\n",
    "    \n",
    "    for i in zip(timess1, timess2):\n",
    "        gh = GetHist(code, start=i[0], end=i[1])\n",
    "        data = gh.get_hist_numpy()\n",
    "        print(data.shape)\n",
    "        data = gh.fall_one(data, step, True)\n",
    "        print(data.shape)\n",
    "\n",
    "    #     data = np.random.randn(4, 20)\n",
    "\n",
    "        X = data[0:-1] / 10\n",
    "        Y = data[-1].reshape(1, -1) / step / 10\n",
    "#         print(X.shape)\n",
    "        \n",
    "        if init_:\n",
    "            np.random.seed(0)\n",
    "            para = init_para([X.shape[0], 20, 15, 1])\n",
    "            init_ = False\n",
    "            \n",
    "#         print(para['W1'].shape)\n",
    "        \n",
    "        A, para = linear(X, para)\n",
    "        cf = cost_function(Y, A)\n",
    "        cost_list.append(cf)\n",
    "        x = []\n",
    "\n",
    "        for i in range(learning_times):\n",
    "            d_para = {}\n",
    "            A, para = linear(X, para)\n",
    "    #         print('A' is str(A))\n",
    "            dA = cost_back(Y, A)\n",
    "            para_len = len(para) // 3\n",
    "\n",
    "            d_para['dZ' + str(para_len)] = dZ = active_back(para['A' + str(para_len)], dA, 'tanh')\n",
    "            d_para['dW' + str(para_len)], d_para['db' + str(para_len)], d_para['dA' + str(para_len)] = linear_back(\n",
    "                    para['A' + str(para_len-1)], para['W' + str(para_len)], para['b' + str(para_len)], dZ)\n",
    "            dA = d_para['dA' + str(para_len)]\n",
    "\n",
    "            para['W' + str(para_len)] -= d_para['dW' + str(para_len)] * learning_rate\n",
    "            para['b' + str(para_len)] -= d_para['db' + str(para_len)] * learning_rate\n",
    "\n",
    "    #         print(d_para['dW' + str(para_len)])\n",
    "    #         print(d_para['db' + str(para_len)])\n",
    "    #         print(para['W' + str(para_len)])\n",
    "    #         print(para['b' + str(para_len)])\n",
    "\n",
    "            for dp in reversed(range(1, para_len)):\n",
    "                d_para['dZ' + str(dp)] = dZ = active_back(para['A' + str(dp)], dA, 'relu')\n",
    "\n",
    "                if dp == 1:\n",
    "                    d_para['dW' + str(dp)], d_para['db' + str(dp)], d_para['dA' + str(dp)] = linear_back(\n",
    "                        X, para['W' + str(dp)], para['b' + str(dp)], dZ)\n",
    "                else:\n",
    "                    d_para['dW' + str(dp)], d_para['db' + str(dp)], d_para['dA' + str(dp)] = linear_back(\n",
    "                        para['A' + str(dp-1)], para['W' + str(dp)], para['b' + str(dp)], dZ)\n",
    "                dA = d_para['dA' + str(dp)]\n",
    "\n",
    "                para['W' + str(dp)] -= d_para['dW' + str(dp)] * learning_rate\n",
    "                para['b' + str(dp)] -= d_para['db' + str(dp)] * learning_rate\n",
    "    #             print(d_para['dW' + str(dp)])\n",
    "    #             print(d_para['db' + str(dp)])\n",
    "    #             print(para['W' + str(dp)])\n",
    "    #             print(para['b' + str(dp)])\n",
    "\n",
    "            cf = cost_function(Y, A)\n",
    "            x.append(i)\n",
    "            cost_list.append(cf)\n",
    "        x.append(i+1)\n",
    "        \n",
    "#     print(cost_list)\n",
    "    from matplotlib import pyplot as plt\n",
    "    plt.plot(x, cost_list)\n",
    "    plt.show()\n",
    "    print(cost_list[-1])\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(14, 13)\n",
      "(29, 10)\n",
      "(14, 13)\n",
      "(29, 10)\n",
      "(14, 16)\n",
      "(29, 13)\n",
      "(14, 15)\n",
      "(29, 12)\n",
      "(14, 14)\n",
      "(29, 11)\n",
      "(14, 15)\n",
      "(29, 12)\n",
      "(14, 16)\n",
      "(29, 13)\n"
     ]
    },
    {
     "ename": "ValueError",
     "evalue": "x and y must have same first dimension, but have shapes (1001,) and (7007,)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-17-8e1adc78d281>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmain_run\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'601699'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2018-01-01'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2018-01-20'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1000\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0.01\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m<ipython-input-16-078fca659a2f>\u001b[0m in \u001b[0;36mmain_run\u001b[0;34m(code, start, end, step, learning_times, learning_rate)\u001b[0m\n\u001b[1;32m     77\u001b[0m \u001b[0;31m#     print(cost_list)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     78\u001b[0m     \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpyplot\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 79\u001b[0;31m     \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcost_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     80\u001b[0m     \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     81\u001b[0m     \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcost_list\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python3.6/site-packages/matplotlib/pyplot.py\u001b[0m in \u001b[0;36mplot\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m   3356\u001b[0m                       mplDeprecation)\n\u001b[1;32m   3357\u001b[0m     \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3358\u001b[0;31m         \u001b[0mret\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0max\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   3359\u001b[0m     \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3360\u001b[0m         \u001b[0max\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_hold\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mwashold\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python3.6/site-packages/matplotlib/__init__.py\u001b[0m in \u001b[0;36minner\u001b[0;34m(ax, *args, **kwargs)\u001b[0m\n\u001b[1;32m   1853\u001b[0m                         \u001b[0;34m\"the Matplotlib list!)\"\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mlabel_namer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__name__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1854\u001b[0m                         RuntimeWarning, stacklevel=2)\n\u001b[0;32m-> 1855\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0max\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1856\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1857\u001b[0m         inner.__doc__ = _add_data_doc(inner.__doc__,\n",
      "\u001b[0;32m/usr/local/lib/python3.6/site-packages/matplotlib/axes/_axes.py\u001b[0m in \u001b[0;36mplot\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m   1525\u001b[0m         \u001b[0mkwargs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcbook\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnormalize_kwargs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_alias_map\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1526\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1527\u001b[0;31m         \u001b[0;32mfor\u001b[0m \u001b[0mline\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_lines\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1528\u001b[0m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madd_line\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1529\u001b[0m             \u001b[0mlines\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python3.6/site-packages/matplotlib/axes/_base.py\u001b[0m in \u001b[0;36m_grab_next_args\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m    404\u001b[0m                 \u001b[0mthis\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    405\u001b[0m                 \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 406\u001b[0;31m             \u001b[0;32mfor\u001b[0m \u001b[0mseg\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_plot_args\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mthis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    407\u001b[0m                 \u001b[0;32myield\u001b[0m \u001b[0mseg\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    408\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python3.6/site-packages/matplotlib/axes/_base.py\u001b[0m in \u001b[0;36m_plot_args\u001b[0;34m(self, tup, kwargs)\u001b[0m\n\u001b[1;32m    381\u001b[0m             \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mindex_of\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtup\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    382\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 383\u001b[0;31m         \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_xy_from_xy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    384\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    385\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcommand\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'plot'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python3.6/site-packages/matplotlib/axes/_base.py\u001b[0m in \u001b[0;36m_xy_from_xy\u001b[0;34m(self, x, y)\u001b[0m\n\u001b[1;32m    240\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    241\u001b[0m             raise ValueError(\"x and y must have same first dimension, but \"\n\u001b[0;32m--> 242\u001b[0;31m                              \"have shapes {} and {}\".format(x.shape, y.shape))\n\u001b[0m\u001b[1;32m    243\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mndim\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m2\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mndim\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    244\u001b[0m             raise ValueError(\"x and y can be no greater than 2-D, but have \"\n",
      "\u001b[0;31mValueError\u001b[0m: x and y must have same first dimension, but have shapes (1001,) and (7007,)"
     ]
    }
   ],
   "source": [
    "main_run('601699', '2018-01-01', '2018-01-20', 2, 1000, 0.01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
